<%@ page import="database.TakeCourseDb" %><%--
  Created by IntelliJ IDEA.
  User: Thinkpad
  Date: 2016/12/11
  Time: 15:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>执行选课</title>
</head>
<body>
<%
    if (request.getParameter("studentId") == null || request.getParameter("courseId") == null) {
        response.getWriter().print("<script>location.href='../../error.jsp?error_code=108'</script>");
    } else {
        String studentId = request.getParameter("studentId");
        int courseId = Integer.parseInt(request.getParameter("courseId"));
        TakeCourseDb.addCourseForStudent(studentId, courseId);
        response.getWriter().print("<script>alert('添加成功！'); location.href='../selectCourse.jsp'</script>");
    }
%>
</body>
</html>
